package com.edu.internship.util.excel;

import com.edu.internship.glabal.constants.ExcelSensitiveConstants;
import lombok.Data;

/**
 * code is far away from bug with the animal protecting
 *
 * @author lishiquan
 * @description
 * @date Create in 2018/11/16 10:01
 */
@Data
public class ExcelElement {

    public static final String STRING = "0";
    public static final String NUMERIC = "1";
    public static final String DATE = "2";
    public static final String DICT = "3";
    public static final String SENSITIVE = "4";

    private String header;
    private String fieldName;
    private String checkValue;
    private String formatter;
    private ExcelSensitiveConstants.SensitiveTypeEnum typeEnum;

    /**
     * 主要用于读取excel的
     *
     * @param fieldName 对应实体类的字段
     */
    public ExcelElement(String fieldName) {
        this.fieldName = fieldName;
    }

    /**
     * 主要用于导出excel的
     *
     * @param header    题头
     * @param fieldName 对应实体类的字段
     */
    public ExcelElement(String header, String fieldName) {
        this.header = header;
        this.fieldName = fieldName;
        this.checkValue = STRING;
    }

    /**
     * 主要用于导出excel的
     *
     * @param header     题头
     * @param fieldName  对应实体类的字段
     * @param checkValue 值的类型
     * @param formatter  格式串,或者字典名
     */
    public ExcelElement(String header, String fieldName, String checkValue, String formatter) {
        this.header = header;
        this.fieldName = fieldName;
        this.checkValue = checkValue;
        this.formatter = formatter;
    }

    /**
     * @param header     题头
     * @param fieldName  对应实体类的字段
     * @param typeEnum   脱敏类型
     */
    public ExcelElement(String header, String fieldName, ExcelSensitiveConstants.SensitiveTypeEnum typeEnum) {
        this.header = header;
        this.fieldName = fieldName;
        this.checkValue = SENSITIVE;
        this.typeEnum = typeEnum;
    }

}
